package com.bilibili.dto;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class JsonResult {
    /**
     * 属性描述: 状态码，与HTTP状态码一致
     */
    private Integer code;
    /**
     * 属性描述: 错误信息，挡状态码为非正常状态码时会有错误信息
     */
    private String error;
    /**
     * 属性描述: RESTful接口中需要返回给前端的一些有用数据，例如查询后的结果
     */
   private Object data;

    public Integer getCode() {
        return code;
    }

    public JsonResult setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getError() {
        return error;
    }

    public JsonResult setError(String error) {
        this.error = error;
        return this;
    }

    public Object getData() {
        return data;
    }

    public JsonResult setData(Object data) {
        this.data = data;
        return this;
    }

    @Override
    public String toString() {
        return "JsonResult{" +
                "code=" + code +
                ", error='" + error + '\'' +
                ", data=" + data +
                '}';
    }
}
